import {pageMgr} from "../../modules/coreModule/managers/PageManager";
import CustomEvent = WechatMiniprogram.CustomEvent;
import {RecruitDetailPage} from "../../pages/recruitDetail/RecruitDetailPage";
import {UserDetailPage} from "../../pages/userDetail/UserDetailPage";

Component({
	properties: {
		type: {
			type: Number,
			value: 0
		},
		tasks: {
			type: Object,
			value: []
		}
	},
	options:{
		addGlobalClass: true
	},
	data: {
	},
	methods: {
		async toDetail(e:CustomEvent){
			const index = e.currentTarget.dataset.i;
			await pageMgr().push(RecruitDetailPage,
				{id: this.data.tasks[index]._id});
		},
		async showUserDetail(e) {
			console.log(e.target.dataset.user);
			await pageMgr().push(UserDetailPage, {id: e.target.dataset.user})
		}
	}
})
